home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hottest 6
/
Hottest 6 (1996)(PDSoft)[!].iso
/
software
/
programming
/
pascal
/
hspascal-units2.lha
/
New
/
Test.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-03-06
|
3KB
|
83 lines
{ * This is a test program set up to use the unit "Base".
The whole concept behind this is to make units that "take care of
themselves"... you use them, and as soon as your program is finished,
either through a normal termination or a Halt(..), they clean up
after themselves.
I'm just starting the process of making a bunch of these to make my
life easier. Look for something that uses GadTools sometime soonish.
Just to note: rather small, isn't it? No need to OpenLibrary yourself
or anything complex. YES, I got sick of copying my window and screen
routines around <grin> --- hopefully someone can benefit from my
laziness ;-)
Written in HighSpeed Pascal 1.10 by Ritchie Annand
}
program Test;
uses Exec,Graphics,Intuition,Base,Gadgets;
{ ^ Base and Gadgets are our custom units }
var
scr : pScreen; { Pointer to a screen type }
bwin: pWindow; { A couple of window pointers }
win : pWindow;
msg : pIntuiMessage; { Pointer to a message type, of course }
done: boolean;
menuno : word; { Menu number selected }
itemno : word; { Item number selected }
subno : word; { Subitem number selected }
begin
{--- Use NewScreen routine to open a screen that will be automatically
taken care of ---}
scr := NewScreen(640,400,2,HIRES or LACE,'',TRUE);
{--- Use NewWindow routine to open a borderless window, the size of the
whole screen, that will be automatically taken care of ---}
bwin := NewWindow(0,0,640,400,
0,BORDERLESS,
0,0,0,0,'',scr);
{--- Use NewWindow to open up a little "Hello" window ---}
win := NewWindow(0,0,320,200,
CLOSEWINDOW_ or MENUPICK,
WINDOWCLOSE or WINDOWDRAG,
200,100,640,400,'Hello',scr);
AddTitle('My menu');
AddChoice('My choice',#0,0,0,TRUE);
AddChoice('My second choice',#0,0,0,TRUE);
AddChoice('_',#0,0,0,TRUE);
AddChoice('My third choice',#0,0,0,TRUE);
AddTitle('My second menu');
AddChoice('Take command','T',0,0,TRUE);
AddChoice('A submenu!',#0,0,0,TRUE);
AddChoice('Submenu hamburger','H',0,0,FALSE);
AddChoice('Submenu noodles','N',0,0,FALSE);
if not MakeMenu(win) then
exit;
{--- Wait for the user to click on the close gadget or menu choice ---}
done := FALSE;
msg := nil;
repeat
{ Wait returns a value, but we'll ignore it }
if Wait(1 shl win^.UserPort^.mp_SigBit)=0 then;
msg := pIntuiMessage(GetMsg(win^.UserPort));
if msg<>nil then
begin
with msg^ do
case Class of
IDCMP_MENUPICK :
begin
menuno := (Code and MENUNUM) shr MENUSHIFT;
itemno := (Code and ITEMNUM) shr ITEMSHIFT;
subno := (Code and SUBNUM) shr SUBSHIFT;
writeln('Picked MENU ',menuno,' ITEM ',itemno,
' SUBITEM ',subno)
end;
IDCMP_CLOSEWINDOW :
done := TRUE
end;
ReplyMsg(pMessage(msg))
end
until done
end.